Skip to content

feat: publish emulator image directly from testing library#196

Open
SilanHe wants to merge 53 commits intomainfrom
feat/publish-emulator-image
Open

feat: publish emulator image directly from testing library#196
SilanHe wants to merge 53 commits intomainfrom
feat/publish-emulator-image

Conversation

@SilanHe
Copy link
Contributor

@SilanHe SilanHe commented Feb 24, 2026

Issue #, if available:

Description of changes: Create emulator image from the python testing library. For each release, we should update the version in the pyproject.poml file in the emulator folder. The image tag will be the aws-durable-sdk-python-testing version with v prefixing it, e.g. v1.1.1.

Dependencies

If this PR requires testing against a specific branch of the Python Language SDK (e.g., for unreleased changes), uncomment and specify the branch below. Otherwise, leave commented to use the main branch.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@bchampp
Copy link
Member

bchampp commented Feb 24, 2026

🤖 Emulator PR Created

A draft PR has been created with locked dependencies:

➡️ https://github.com/aws/aws-durable-execution-emulator/pull/401

The emulator will build binaries using the exact testing SDK commit locked in uv.lock.

@bchampp
Copy link
Member

bchampp commented Feb 24, 2026

🔄 Emulator PR Updated

The emulator PR has been updated with locked dependencies:

➡️ https://github.com/aws/aws-durable-execution-emulator/pull/401

@bchampp
Copy link
Member

bchampp commented Feb 24, 2026

🔄 Emulator PR Updated

The emulator PR has been updated with locked dependencies:

➡️ https://github.com/aws/aws-durable-execution-emulator/pull/401

@bchampp
Copy link
Member

bchampp commented Feb 25, 2026

🔄 Emulator PR Updated

The emulator PR has been updated with locked dependencies:

➡️ https://github.com/aws/aws-durable-execution-emulator/pull/401

@bchampp
Copy link
Member

bchampp commented Feb 25, 2026

🔄 Emulator PR Updated

The emulator PR has been updated with locked dependencies:

➡️ https://github.com/aws/aws-durable-execution-emulator/pull/401

@bchampp
Copy link
Member

bchampp commented Feb 25, 2026

🔄 Emulator PR Updated

The emulator PR has been updated with locked dependencies:

➡️ https://github.com/aws/aws-durable-execution-emulator/pull/401

@bchampp
Copy link
Member

bchampp commented Feb 25, 2026

🔄 Emulator PR Updated

The emulator PR has been updated with locked dependencies:

➡️ https://github.com/aws/aws-durable-execution-emulator/pull/401

@bchampp
Copy link
Member

bchampp commented Feb 26, 2026

🔄 Emulator PR Updated

The emulator PR has been updated with locked dependencies:

➡️ https://github.com/aws/aws-durable-execution-emulator/pull/401

@bchampp
Copy link
Member

bchampp commented Feb 26, 2026

🔄 Emulator PR Updated

The emulator PR has been updated with locked dependencies:

➡️ https://github.com/aws/aws-durable-execution-emulator/pull/401

Comment on lines 25 to 26
"aws-durable-execution-sdk-python-testing~=1.1.1",
"aws_durable_execution_sdk_python~=1.3.0",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to update these for each release made to the testing library so that we know exactly what versions of the sdk we are using.

@SilanHe SilanHe marked this pull request as ready for review February 26, 2026 00:31
@yaythomas
Copy link
Member

yaythomas commented Feb 26, 2026

suggestion: could simplify by putting emulator under the src, so that the source lives here:

src/emulator/

this then goes into the pyproject.toml in root:

[project.scripts]
dex-local-runner = "aws_durable_execution_sdk_python_testing.cli:main"
dex-emulator = "aws_durable_execution_sdk_python_testing.emulator.server:main"

however, all of that said, does the emulator server + factory + config actually add anything that the existing cli code doesn't already do?

so, you can start the local runner like this, and I think this is equivalent, or am I missing something:

dex-local-runner start-server \
  --host 0.0.0.0 \
  --port 5000 \
  --log-level INFO \
  --lambda-endpoint http://localhost:3001 \
  --store-type sqlite \
  --store-path ./durable-executions.db

Alternatively, these $envs - these are not the same as in emulator config though, which just has HOST, PORT, LOG, EXECUTION_STORE_TYPE etc:

# Set these once:
export AWS_DEX_HOST=0.0.0.0
export AWS_DEX_PORT=5000
export AWS_DEX_LOG_LEVEL=INFO
export AWS_DEX_LAMBDA_ENDPOINT=http://localhost:3001
export AWS_DEX_STORE_TYPE=sqlite
export AWS_DEX_STORE_PATH=./durable-executions.db

# Then just run:
dex-local-runner start-server

These emulator entries do not look like they're used outside of the emulator itself, though, because https://github.com/aws/aws-sam-cli/blob/f466a449eb5137dafa002b68e97ed0b03a8feafa/samcli/local/docker/durable_functions_emulator_container.py#L39-L75

Port: User can override via DURABLE_EXECUTIONS_EMULATOR_PORT env var
Store type: User can override via DURABLE_EXECUTIONS_STORE_TYPE env var
Host: HARDCODED to 0.0.0.0 (no user override)
Data dir: HARDCODED to .durable-executions-local in cwd (no user override)

The Dockerfile would then look something like this:

FROM python:3.13-slim

# Copy and install the wheel
COPY dist/*.whl /tmp/
RUN pip install --no-cache-dir /tmp/*.whl && rm -rf /tmp/*.whl

# AWS credentials (required for boto3)
ENV AWS_ACCESS_KEY_ID=foo \
    AWS_SECRET_ACCESS_KEY=bar \
    AWS_DEFAULT_REGION=us-east-1

EXPOSE 9014

HEALTHCHECK --interval=10s --timeout=3s --start-period=5s \
    CMD python -c "import urllib.request; urllib.request.urlopen('http://localhost:9014/health').read()" || exit 1

CMD ["dex-local-runner", "start-server", \
     "--host", "0.0.0.0", \
     "--port", "9014", \
     "--log-level", "DEBUG", \
     "--lambda-endpoint", "http://host.docker.internal:3001", \
     "--store-type", "sqlite", \
     "--store-path", "/tmp/.durable-executions-local/durable-executions.db"]

The version number of the emulator container then becomes the SAME as the testing lib version number:

name: Build and Push Docker Image

on:
  release:
    types: [published]

jobs:
  docker:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      
      - name: Set up Python
        uses: actions/setup-python@v5
        with:
          python-version: '3.13'
      
      - name: Install hatch
        run: pip install hatch
      
      - name: Build wheel with hatch
        run: hatch build --target wheel
      
      - name: Get version from __about__.py
        id: version
        run: |
          VERSION=$(python -c "from src.aws_durable_execution_sdk_python_testing.__about__ import __version__; print(__version__)")
          echo "VERSION=${VERSION}" >> $GITHUB_OUTPUT
      
      - name: Build and push Docker image
        run: |
          VERSION=${{ steps.version.outputs.VERSION }}
          docker build -t public.ecr.aws/your-repo/dex-local-runner:${VERSION} .
          docker tag public.ecr.aws/your-repo/dex-local-runner:${VERSION} public.ecr.aws/your-repo/dex-local-runner:latest
          docker push public.ecr.aws/your-repo/dex-local-runner:${VERSION}
          docker push public.ecr.aws/your-repo/dex-local-runner:latest

in summary: you could simplify this by getting rid of emulator directory entirely and just injecting the appropriate args via the Dockerfile.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants